import { getSystemParameterListApi } from '@/views/system/api/system.api';

const state = {
  parameterList: []
};

const mutations = {
  SET_PARAMETER_LIST(state, data) {
    state.parameterList = data;
  }
};

const actions = {
  getSystemParameterList({ commit }, queryParams) {
    return new Promise((resolve, reject) => {
      getSystemParameterListApi(queryParams).then(response => {
        const { data } = response;
        const { results } = data
        commit('SET_PARAMETER_LIST', results);
        resolve(response)
      }).catch(error => {
        reject(error);
      });
    });
  }
};

export default {
  namespaced: true,
  state,
  mutations,
  actions
};
